package router

import (
	"jgt-oper/src/context"
	"jgt-oper/src/svc"

	"github.com/facebookgo/inject"
	"github.com/teambition/gear"
)

// SvcDictionaryMap 注册路由映射
func SvcDictionaryMap(g *inject.Graph, r *gear.Router) {
	a := new(svc.Dictionary)
	err := g.Provide(&inject.Object{Value: a})
	if err != nil {
		panic(err)
	}

	r.Get("/dictionaries/data", context.WrapContext(a.QueryTree))
	r.Get("/dictionaries/tree", context.WrapContext(a.QueryShowTree))
	r.Get("/dictionaries/list", context.WrapContext(a.QueryNameList))
	r.Get("/dictionaries/one", context.WrapContext(a.GetByCode))
}
